﻿using CID.Domain;
using CID.Execution.Support.Contracts;
using CID.Tests.Support;
using NailsFramework;
using Rhino.Mocks;

namespace CID.Execution.Agent.Tests
{
    class BaseAgentTests : BaseFunctionalTests
    {
        protected override void ConfigureNails(NailsFramework.Config.INailsConfigurator nails)
        {
            Nails.Configure()
                .Persistence.DataMapper<NailsFramework.Persistence.NullDataMapper>()
                .UserInterface.Platform<NailsFramework.UserInterface.NullUIPlatform>()
                .IoC.Container<NailsFramework.IoC.Unity>()
                .Logging.Logger<NailsFramework.Logging.Log4net>()
                .InspectAssemblyOf<IAgentCoordinator>()
                .InspectAssemblyOf<BaseAgentTests>()
                .InspectAssemblyOf<IAgentService>()
                .Initialize();
        }

        protected static TStub GenerateNamedEntityStub<TStub>() where TStub : class, INamedEntity
        {
            var result = MockRepository.GenerateStub<TStub>();
            result.Stub(x => x.Id).Return(0);
            result.Name = typeof(TStub).Name + " Name";
            return result;
        }

    }
}
